package top.frsf.pattern.b_structural.b_proxy.b_jdk;

import lombok.Data;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * @author He Kuntao
 * @since 2024/9/18 17:10
 */
@Data
public class DynamicProxy implements InvocationHandler {

    private Object target;

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("[proxy]: before params process");
        Object result = method.invoke(target, args);
        System.out.println("[proxy]: after response header");
        return result;
    }
}
